/*
 * Copyright 2018 Zhongan.com All right reserved. This software is the
 * confidential and proprietary information of Zhongan.com ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Zhongan.com.
 */

package com.example.cloud.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.cloud.model.UserInfo;

import lombok.extern.slf4j.Slf4j;

/**
 * HelloService
 *
 * @author tongyufu
 */
@Slf4j
@RestController
public class HelloService {

    @Autowired
    private DiscoveryClient client;

    /**
     * hello
     *
     * @return hello
     */
    @RequestMapping("hello")
    public String hello() {
        return "Hello world";
    }

    /**
     * 限流
     *
     * @return hello
     */
    @RequestMapping("rate/hello")
    public String limit() {
        log.info("------limit");
        return "Hello";
    }

    /**
     * requestBody
     *
     * @param userInfo userInfo
     * @return name
     */
    @RequestMapping("/requestBody")
    public String body(@RequestBody UserInfo userInfo) {
        return userInfo.getName();
    }
}
